package com.example.carbon.demos.web.controller;


import com.example.carbon.demos.web.entity.User;
import com.example.carbon.demos.web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wms
 * @since 2024-09-09
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/list")
    public List<User> list(){
        System.out.println("ppp");
        return userService.list();
    }

    //新增
    @PostMapping("/save")  //@RequestBody是接受前端传来的JSON字符串 必须红日Post使用
    public boolean save(@RequestBody User user){
        return userService.save(user);
    }
    //修改

    //删除


}
